package com.jinghaizhao.gqgl.login.controller;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.Locale;

@Controller
@RequestMapping("/login")
public class LoginController {
    private Logger logger = LogManager.getLogger(this.getClass());
    @RequestMapping("/login")
    public String login(HttpServletRequest request){
        Locale locale =LocaleContextHolder.getLocale();
        request.getSession().setAttribute("siteLanguage",locale.toString());
        logger.info("login");
        return "login/login";

    }
    @RequestMapping("/main")
    public String main(){
        logger.info("main");
        return "redirect:/";

    }
}